<?php
/**
 * Object Relational Persistence Mapping Class for table: lab_item_factor
 * @package modules.dept_laboratory.ordo
 * @author viethd
 * @version $Id$
 * @copyright 2009 LHV Company
 */
class LabItemFactor extends ORDataObject {

	/**#@+
	 * Fields of table: lab_item_factor mapped to class members
	 */
	var $lab_item_factor_id		= '';
	var $vi_name		= '';
	var $en_name		= '';
	var $enum_unit		= '';
	var $normal_result_male		= '';
	var $normal_result_female		= '';
	var $service_id		= '';
	var $enum_data_type		= '';
	/**#@-*/


	/**
	 * DB Table
	 */
	var $_table = 'lab_item_factor';

	/**
	 * Primary Key
	 */
	var $_key = 'lab_item_factor_id';
	
	/**
	 * Internal Name
	 */
	var $_internalName = 'LabItemFactor';

	/**
	 * Handle instantiation
	 */
	function __construct() {
		parent::ORDataObject();
	}
	
	public function listLabResultItemsOfService($serviceId) {
        $field    =   L10nHelper::changeField(L10nHelper::getLocale(), 'name');
        $ds =& new Datasource_sql();
        $sql = array(
                'cols'  => "lab_item_factor_id, t.$field name, normal_result_male, 
                            normal_result_female, enum_data_type, enum_unit",                            
                'from'  => "$this->_table t",                                   
                'where' =>   "service_id ='$serviceId'"            
                );
        $ds->setup($this->_db, $sql);
        $result = $ds->toArray();        
        return $result;        
    }
    

	
}
?>
